- 
                Notifications
    You must be signed in to change notification settings 
- Fork 59
feat/add chain values converters #202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
         aarmoa
  
      
      
      commented
      
            aarmoa
  
      
      
      commented
        Jan 15, 2024 
      
    
  
- Added new functions in all Market classes to convert values from extended chain format (the ones provided by chain streams) into human-readable format
- Updated proto definitions for Indexer node using version v1.12.79.1
- Updated market and tokens INI configuration files
…ded chain format into human readable format. Updated Indexer proto definitions pointing to 1.12.79.1
| Codecov ReportAttention:  
 
 Additional details and impacted files@@            Coverage Diff             @@
##           master     #202      +/-   ##
==========================================
+ Coverage   29.46%   29.71%   +0.25%     
==========================================
  Files          17       17              
  Lines        2552     2564      +12     
==========================================
+ Hits          752      762      +10     
- Misses       1764     1766       +2     
  Partials       36       36              ☔ View full report in Codecov by Sentry. | 
        
          
                client/core/market.go
              
                Outdated
          
        
      | } | ||
|  | ||
| func (spotMarket SpotMarket) fromExtendedChainformat(chainValue decimal.Decimal) decimal.Decimal { | ||
| return chainValue.Div(decimal.New(1, AdditionalChainFormatDecimals)) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to do this in utils file, this one doesn't depend on spotMarket or derivativeMarket
fromExtendedChainformat(chainValue decimal.Decimal) decimal.Decimal
But why chainValue has decimal.Decimal type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, will move it (unfortunately moving it to utils makes it less OOP, something that I don't really like)
Regarding the chainValue, it was not originally decimal.Decimal. But the function that calls this one first translates the value according to market tokens decimals, making it a decimal.Decimal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfortunately moving it to utils makes it less OOP, something that I don't really like
Yeah it's a tool and we need flexibility to choose which to use
Regarding the chainValue, it was not originally decimal.Decimal. But the function that calls this one first translates the value according to market tokens decimals, making it a decimal.Decimal
Oh I thought using sdk.Dec is enough when chain streamed the value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please fix lint issue